<!DOCTYPE html>
<html>
<!-- 
    @author: 胡校辉
    @title: 商品和服务税占财政收入比重
 -->
<head lang="zh-CN">
    <title>商品和服务税占财政收入比重</title>

    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">

    <meta charset="utf-8">

    <!-- 引入Jquery -->
    <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>

    <!-- 引入Bootstrap -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>

    <!-- 引入BootStrap-table -->
    <link rel="stylesheet" href="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.css">
    <script src="../assets/libs/bootstrap-table-master/dist/bootstrap-table.min.js"></script>

    <!-- 引入Bootstrap-paginator -->
    <script src="../assets/libs/bootstrap-paginator-master/build/bootstrap-paginator.min.js"></script>

    <!-- 引入Echarts -->
    <script src="../assets/libs/echarts/echarts.min.js"></script>
    <style>
        .th-inner{
            text-align: center;
        }
    </style>
</head>
<body>
<div class="container">
    <div>
        <ul class="nav nav-tabs">
            <li role="presentation" id="tableTag"><a href="javascript:;" onclick="showTable()">&nbsp;<span class="glyphicon glyphicon-th-large"></span>&nbsp;</a></li>
            <li role="presentation" id="imageTag"><a href="javascript:;" onclick="showImage()">&nbsp;<span class="glyphicon glyphicon-tasks"></span>&nbsp;</a></li>
        </ul>
    </div>

    <div id="tableView">
        <div class="page-header" style="text-align: center;">
            <h3>商品和服务税占财政收入比重</h3>
            <br>
            <h4 style="margin-top: -20px;">Goods and Services Tax as Percentage of Revenue</h4>
        </div>

        <div style="text-align: right;">单位:&nbsp;%</div>

        <table id="tableData" style="text-align: center"></table>
    </div>

    <div id="imageView">
        <div class="page-header" style="text-align: center;visibility: hidden;" id="imageTitle">
            <h3>商品和服务税占财政收入比重柱状图</h3>
            <br>
            <h4 style="margin-top: -20px;">Goods and Services Tax as Percentage of Revenue</h4>
        </div>

        <div class="panel" style="margin-top: 40px;">
            <!--<div style="text-align: right;">单位:&nbsp;%</div>-->
            <div id="main" style="width: 100%;height:400px;"></div>
        </div>
    </div>

    <div style="color: #959595; margin-top: 1.5em;">*此数据仅展现最近五年，若需全部数据请点击&nbsp;<a href="#" class="btn btn-info btn-xs">
        <span class="glyphicon glyphicon-save"></span> 下载
    </a></div>


    <!-- <div style="text-align: right;"><div id="page"></div></div> -->
</div>
</body>
<!-- 引入组装数据的Js -->
<script src="../assets/libs/utils/general-data.js"></script>
<script>
    $(function(){
        $('#imageView').hide();
        $('#tableTag').attr('class','active');
    })

    function showTable() {
        $('#tableView').show();
        $('#imageView').hide();
        $('#imageTitle').css('visibility','hidden');
        $('#tableTag').attr('class', 'active');
        $('#imageTag').removeClass('active');
    }

    function showImage() {
        $('#imageView').show();
        $('#imageTitle').css('visibility','visible');
        $('#tableView').hide();
        $('#imageTag').attr('class', 'active');
        $('#tableTag').removeClass('active');
    }

    $('#tableData').bootstrapTable({
        striped: true,
        columns: [
            {
                field: 'country',
                title: '国家或地区'
            },
            {
                field: 'year1',
                title: '2000年'
            },
            {
                field: 'year2',
                title: '2005年'
            },
            {
                field: 'year3',
                title: '2010年'
            },
            {
                field: 'year4',
                title: '2013年'
            },
            {
                field: 'year5',
                title: '2014年'
            },
            {
                field: 'year6',
                title: '2015年'
            },
        ],
        data: [
            {
                country: '阿尔巴尼亚',
                year1: '',
                year2: '',
                year3: '',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '爱沙尼亚',
                year1: '37.76',
                year2: '40.84',
                year3: '38.21',
                year4: '39.94',
                year5: '',
                year6: '',
            },
            {
                country: '波黑',
                year1: '',
                year2: '22.67',
                year3: '44.86',
                year4: '43.86',
                year5: '42.98',
                year6: '',
            },
            {
                country: '保加利亚',
                year1: '38.25',
                year2: '42.54',
                year3: '45.67',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '波兰',
                year1: '37.53',
                year2: '36.37',
                year3: '38.35',
                year4: '35.75',
                year5: '55.46',
                year6: '',
            },
            {
                country: '黑山',
                year1: '',
                year2: '',
                year3: '',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '捷克',
                year1: '34.32',
                year2: '26.73',
                year3: '28.12',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '克罗地亚',
                year1: '46.48',
                year2: '47.59',
                year3: '45.99',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '罗马尼亚',
                year1: '32.17',
                year2: '37.37',
                year3: '36.35',
                year4: '39.73',
                year5: '38.21',
                year6: '',
            },
            {
                country: '立陶宛',
                year1: '32.77',
                year2: '33.13',
                year3: '33.26',
                year4: '33.15',
                year5: '32.58',
                year6: '',
            },
            {
                country: '拉脱维亚',
                year1: '40.33',
                year2: '38.69',
                year3: '35.32',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '马其顿',
                year1: '',
                year2: '39.77',
                year3: '41.12',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '塞尔维亚',
                year1: '',
                year2: '',
                year3: '45.09',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '斯洛伐克',
                year1: '30.05',
                year2: '37.46',
                year3: '32.65',
                year4: '44.13',
                year5: '43.41',
                year6: '',
            },
            {
                country: '斯洛文尼亚',
                year1: '34.10',
                year2: '33.11',
                year3: '33.92',
                year4: '',
                year5: '',
                year6: '',
            },
            {
                country: '匈牙利',
                year1: '35.03',
                year2: '36.86',
                year3: '37.03',
                year4: '36.96',
                year5: '36.88',
                year6: '',
            },

        ]
    });

    var options={
        bootstrapMajorVersion:1,    //版本
        currentPage:1,    //当前页数
        numberOfPages:5,    //最多显示Page页
        totalPages:10,    //所有数据可以显示的页数
        onPageClicked:function(e,originalEvent,type,page){


        }
    }
    $("#page").bootstrapPaginator(options);

    // 基于准备好的dom，初始化echarts实例
    var myChart = echarts.init(document.getElementById('main'));

    var dataS='["2000年","2005年","2010年","2013年","2014年","2015年"]';
    var dataNames='["zero","five","ten","thirteen","fourteen","fiveteen"]';
    var pageViews='[{"country":"阿尔巴尼亚","five":"　/","fiveteen":"　/","fourteen":"　/","id":1,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"　/","thirteen":"　/","zero":"　/"},{"country":"爱沙尼亚","five":"40.84","fiveteen":"　/","fourteen":"　/","id":2,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"38.21","thirteen":"39.94","zero":"37.76"},{"country":"波黑","five":"22.67","fiveteen":"　/","fourteen":"42.98","id":2,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"44.86","thirteen":"　/","zero":"43.86"},{"country":"保加利亚","five":"42.54","fiveteen":"/","fourteen":"/","id":3,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"45.67","thirteen":"/","zero":"38.25"},{"country":"波兰","five":"36.37","fiveteen":"/","fourteen":"55.46","id":4,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"38.35","thirteen":"35.75","zero":"37.53"},{"country":"黑山","five":"　/","fiveteen":"　/","fourteen":"　/","id":5,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"　/","thirteen":"/　","zero":"/　"},{"country":"捷克","five":"26.73","fiveteen":"/","fourteen":"/","id":6,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"28.12","thirteen":"/","zero":"34.32"},{"country":"克罗地亚","five":"47.59","fiveteen":"/","fourteen":"/","id":7,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"45.99","thirteen":"/","zero":"46.48"},{"country":"罗马尼亚","five":"37.37","fiveteen":"/","fourteen":"38.21","id":8,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"36.35","thirteen":"39.73","zero":"32.17"},{"country":"立陶宛","five":"33.13","fiveteen":"0","fourteen":"32.58","id":9,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"33.26","thirteen":"33.15","zero":"32.77"},{"country":"拉脱维亚","five":" 38.69","fiveteen":"/","fourteen":"/","id":10,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"35.32","thirteen":"/","zero":"40.33"},{"country":"马其顿","five":"39.77","fiveteen":"/","fourteen":"/","id":10,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"41.12","thirteen":"/","zero":"/"},{"country":"塞尔维亚","five":"/","fiveteen":"/","fourteen":"/","id":10,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"45.09","thirteen":"/","zero":"/"},{"country":"斯洛伐克","five":" 37.46","fiveteen":"\","fourteen":"43.41","id":10,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"32.65","thirteen":"44.13","zero":"30.05"},{"country":"斯洛文尼亚","five":"33.11","fiveteen":"/","fourteen":"/","id":10,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"33.92","thirteen":"/","zero":"34.1"},{"country":"匈牙利","five":"36.86","fiveteen":"/","fourteen":"36.88","id":10,"pojoName":"goodsandservicestaxaspercentageofrevenue","ten":"37.03","thirteen":"36.96","zero":"35.03"}]';

    var datas = eval('(' + dataS + ')');
    var dataName = eval('(' + dataNames + ')');
    var pageView = eval('(' + pageViews + ')');

    var contry=new Array();
    var seriesData=new Array();
    for(var i=0;i<datas.length;i++){
        var obj=new Object();
        obj.name=datas[i];
        obj.type='bar';
        obj.data=new Array();
        seriesData.push(obj);
    }
    for(var i=0;i<pageView.length;i++){

        // 		var d=transform(pageView[i]);
        var contrys=pageView[i];
        var c=contrys['country'];
        contry.push(c);
    }

    var i=0;
    for(var j=0;j<dataName.length;j++){
        for(var k=0;k<pageView.length;k++){
            var b=pageView[k];
            var c=b[dataName[j]];
            seriesData[i].data.push(c);
        }
        i++;
    }
    function transform(obj){
        var arr = [];
        for(var item in obj){
            arr.push(obj[item]);
        }
        return arr;
    }
    // 	app.title = '堆叠柱状图';

    option = {
        tooltip : {
            trigger: 'axis',
            axisPointer : {            // 坐标轴指示器，坐标轴触发有效
                type : 'shadow'        // 默认为直线，可选为：'line' | 'shadow'
            }
        },
        legend: {
            data:datas
        },
        title:{
            subtext:'数据来源'
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        xAxis : [
            {
                type : 'category',
                data : contry
            }
        ],
        yAxis : [
            {
                type : 'value',
                name : '%'
            }
        ],
        series : seriesData
    };


    // 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);
</script>
</html>